import os.path

import yaml


class ToolsUtil:
    def load_test_data(self, file_path="../data/test_data.yaml"):
        with open(file_path, "r", encoding="utf-8") as file:
            data = yaml.safe_load(file)
            print(data)

        return [(case['book'],) for case in data["test_cases"]]

    # 获取项目路径
    @staticmethod
    def ger_project_path():
        return os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))

    @staticmethod
    def build_path(*path, add_sep_before=True):
        all_path = os.sep.join(path)
        if add_sep_before:
            all_path = os.sep + all_path
        return all_path


if __name__ == '__main__':
    # print(ToolsUtil().load_test_data())
    print(ToolsUtil.ger_project_path())
    print(ToolsUtil.build_path("img", "full_img"))
    print(ToolsUtil.ger_project_path() + ToolsUtil.build_path("img", "full_img"))
